package org.yray;

import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
import org.springframework.batch.core.repository.support.SimpleJobRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lyg
 * @date 2022/4/4 16:28
 */
@Configuration
public class Conf {

    @Bean
    public JobBuilderFactory jobBuilderFactory(@Autowired JobRepository jobRepository)
    {
        return new JobBuilderFactory(jobRepository);
    }

    /**
     * JobRepository定义：Job的注册容器以及和数据库打交道（事务管理等）
     * @param dataSource
     * @param transactionManager
     * @return
     * @throws Exception
     */
    @Bean
    public JobRepository myJobRepository() throws Exception{

        return null;
    }
}
